# 定义字典
my_dict = {"王力宏": 99, "谢霆锋": 88, "周杰伦": 77}

# 定义空字典
my_dict2 = {}
my_dict3 = dict()
print(f"字典1的内容是:{my_dict},类型是:{type(my_dict)}")
print(f"字典2的内容是:{my_dict2},类型是:{type(my_dict2)}")
print(f"字典3的内容是:{my_dict3},类型是:{type(my_dict3)}")

# 定义重复Key的字典
my_dict = {"王力宏": 99, "谢霆锋": 88, "周杰伦": 77, "王力宏": 99}
print(f"重复key的字典内容是:{my_dict}")

# 从字典中基于Key获取Value
my_dict = {"王力宏": 99, "谢霆锋": 88, "周杰伦": 77}
print("王力宏的分数是:", my_dict["王力宏"])
print("谢霆锋的分数是:", my_dict["谢霆锋"])
print("周杰伦的分数是:", my_dict["周杰伦"])

# 定义嵌套字典
stu_score_dict = {
    "王力宏": {
        "语文": 77,
        "数学": 66,
        "英语": 33
    }, "谢霆锋": {
        "语文": 88,
        "数学": 86,
        "英语": 55
    }, "周杰伦": {
        "语文": 99,
        "数学": 96,
        "英语": 66
    }
}


# 从嵌套字典中获取数据
print(f"学生的考试成绩:{stu_score_dict}")
# 查看周杰伦的语文分数信息
score = stu_score_dict["周杰伦"]["语文"]
print(f"周杰伦的语文分数是:{score}")




